/*
 Navicat Premium Data Transfer

 Source Server         : mysql5.6
 Source Server Type    : MySQL
 Source Server Version : 50631
 Source Host           : localhost:3306
 Source Schema         : myshiro

 Target Server Type    : MySQL
 Target Server Version : 50631
 File Encoding         : 65001

 Date: 23/01/2019 15:15:34
*/

DROP DATABASE IF EXISTS myshiro;
CREATE DATABASE myshiro DEFAULT CHARACTER SET utf8;
USE myshiro;

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for shiro_permission
-- ----------------------------
DROP TABLE IF EXISTS `shiro_permission`;
CREATE TABLE `shiro_permission` (
  `id` varchar(40) DEFAULT NULL COMMENT '权限标志',
  `description` varchar(20) DEFAULT NULL COMMENT '权限描述',
  `parent_id` varchar(20) DEFAULT NULL COMMENT '父节点',
  `level` varchar(20) DEFAULT NULL COMMENT '几级菜单',
  `name` varchar(20) DEFAULT NULL COMMENT '权限名称',
  `url` varchar(100) DEFAULT NULL COMMENT '跳转url'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限表';

-- ----------------------------
-- Records of shiro_permission
-- ----------------------------
BEGIN;
INSERT INTO `shiro_permission` VALUES ('1', NULL, NULL, NULL, 'ADMIN', '');
INSERT INTO `shiro_permission` VALUES ('2', '', NULL, NULL, 'USER', NULL);
COMMIT;

-- ----------------------------
-- Table structure for shiro_role
-- ----------------------------
DROP TABLE IF EXISTS `shiro_role`;
CREATE TABLE `shiro_role` (
  `id` int(40) NOT NULL,
  `name` varchar(30) DEFAULT NULL COMMENT '角色名称',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表';

-- ----------------------------
-- Records of shiro_role
-- ----------------------------
BEGIN;
INSERT INTO `shiro_role` VALUES (1, '超级管理员');
INSERT INTO `shiro_role` VALUES (2, '普通用户');
COMMIT;

-- ----------------------------
-- Table structure for shiro_role_permission
-- ----------------------------
DROP TABLE IF EXISTS `shiro_role_permission`;
CREATE TABLE `shiro_role_permission` (
  `role_id` varchar(20) NOT NULL COMMENT '角色id',
  `permission_id` varchar(20) NOT NULL DEFAULT '' COMMENT '权限标识',
  PRIMARY KEY (`permission_id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色和权限关联表';

-- ----------------------------
-- Records of shiro_role_permission
-- ----------------------------
BEGIN;
INSERT INTO `shiro_role_permission` VALUES ('1', '1');
INSERT INTO `shiro_role_permission` VALUES ('2', '2');
COMMIT;

-- ----------------------------
-- Table structure for shiro_user
-- ----------------------------
DROP TABLE IF EXISTS `shiro_user`;
CREATE TABLE `shiro_user` (
  `id` varchar(40) NOT NULL COMMENT '用户id',
  `login_name` varchar(30) DEFAULT NULL COMMENT '登录名称',
  `nick_name` varchar(30) DEFAULT NULL COMMENT '昵称',
  `password` varchar(50) DEFAULT NULL COMMENT '登录密码',
  `is_locked` char(1) DEFAULT NULL COMMENT '账户是否被锁定',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表';

-- ----------------------------
-- Records of shiro_user
-- ----------------------------
BEGIN;
INSERT INTO `shiro_user` VALUES ('1', 'admin', '超级管理员', 'c41d7c66e1b8404545aa3a0ece2006ac', '0');
INSERT INTO `shiro_user` VALUES ('1eca9f1e02e1474d99a9dd216a6b853b', 'user', '普通用户', '2bbffae8c52dd2532dfe629cecfb2c85', '0');
INSERT INTO `shiro_user` VALUES ('2', 'xiaohong', '普通用户', '730631a893bbd8d8ddfb1b2d30e9bda7', '0');
INSERT INTO `shiro_user` VALUES ('3', 'lala', '被锁定用户', '4e03d5095bec68d0e37ae03752a17e95', '1');
INSERT INTO `shiro_user` VALUES ('aa1f19cf8a3140a68bee858603b3efe2', 'test', '普通用户', 'b0ce72ed0b24728785094ef90b6d00c3', '0');
COMMIT;

-- ----------------------------
-- Table structure for shiro_user_role
-- ----------------------------
DROP TABLE IF EXISTS `shiro_user_role`;
CREATE TABLE `shiro_user_role` (
  `user_id` varchar(40) NOT NULL COMMENT '用户id',
  `role_id` varchar(40) NOT NULL DEFAULT '' COMMENT '角色id',
  PRIMARY KEY (`role_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户和角色关联表';

-- ----------------------------
-- Records of shiro_user_role
-- ----------------------------
BEGIN;
INSERT INTO `shiro_user_role` VALUES ('1', '1');
INSERT INTO `shiro_user_role` VALUES ('2', '2');
INSERT INTO `shiro_user_role` VALUES ('3', '2');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
